import React from 'react';
import { Button, Skeleton } from 'antd';
import { useGetUserInfo } from '@/store/modules/snail/login';

function Login() {
  const {
    // userInfo,
    fetchLoginPending,
    fetchLoginError,
    // dismissFetchLoginError,
    login,
  } = useGetUserInfo();
  return (
    <div className="console-container">
      {<Button onClick={login}>登录</Button>}
      {!fetchLoginError && (
        <Skeleton loading={fetchLoginPending} tip="请稍后">
          <p>{fetchLoginPending ? '加载中...' : ''}</p>
          <p>{fetchLoginError ? '加载失败' : ''}</p>
          {/* <p>{JSON.stringify(userInfo)}</p> */}
        </Skeleton>
      )}
      {fetchLoginError && <Button onClick={login}>重新登录</Button>}
    </div>
  );
}

export default Login;
